/**
 * This file is released under the GNU General Public License.
 * Refer to the COPYING file distributed with this package.
 *
 * Copyright (c) 2008-2009 WURFL-Pro srl
 */
package net.sourceforge.wurfl.core.request.normalizer.generic;

import net.sourceforge.wurfl.core.request.normalizer.UserAgentNormalizer;

/**
 * BlackBerry normalizer.
 * 
 * <p>
 * Strips out the heading "BlackBerry" string.
 * </P>
 * 
 * @author WURFL-PRO SRL, Rome, Italy
 * @version $Id: BlackBerryNormalizer.java 1045 2009-03-09 15:52:53Z filippo.deluca $
 */
public class BlackBerryNormalizer implements UserAgentNormalizer {

	/**
	 * Replaces the heading "BlackBerry" string with "".
	 */
	public String normalize(String userAgent) {

		String normalizedUserAgent = userAgent;

		int index = userAgent.indexOf("BlackBerry");

		if (index != -1 && index > 0) {

			normalizedUserAgent = userAgent.substring(index);

		}
		
		return normalizedUserAgent;
	}

}
